import profile

M = 600851475143
def blur(num):
    if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
        return False
    else:
        return True
def isPrime(num):
    import math
    for i in range(2,int(math.sqrt(num))+1):
        if num % i == 0:
            return False
    return True
def main(num):
    import math
    max1 = 0
    for i in range(2, int(math.sqrt(num))):
        if blur(i):
            if num % i == 0:
                div = num // i
                if isPrime(i):
                    max1 = i
                if isPrime(div):
                    return div
    return max1
print 'this result is:',main(M)
